import React from 'react'
import { Outlet, Link, useLocation, useNavigate } from 'react-router-dom'

export default function App9() {
  const navigate = useNavigate()
  const location = useLocation()

  const pathToList = path => navigate(`/${path}`)
  const ParamsState = () => {
    navigate('/paramsState', {
      state: { username: '王明杰' }
    })
  }
  return (
    <div>
      <ul>
        <li onClick={() => pathToList('home')}>home</li>
        <li>
          <Link to="/detail?id=123">detail</Link>
        </li>
        <li>
          <Link to="/list/123">list</Link>
        </li>
        <li onClick={ParamsState}>ParamsState</li>
      </ul>
      <Outlet></Outlet>
    </div>
  )
}
